<div class="page-3 cart commonPage">
	<div class="bg-3"></div>
	<?php echo $this->element('sidebar'); ?>
	<div class="box-right zhigh">
        <?php echo $this->element('banner'); ?>
            <div class="title">
                <ul class="breadcrumbs">
                    <li><a href="<?php echo $this->General->base_url() ?>"><img style="position: relative; top: 2px;" src="<?php echo $this->webroot ?>images/home-yl-2.png" /></a></li>
                    <?php
                        foreach($breadcrumbs as $breadcrumb)
                        {
                            echo '<li><a href="'.$this->General->base_url().$breadcrumb['link'].'">'.$breadcrumb['title'].'</a></li>';
                        }
                    ?>
                </ul>
			</div>
		<?php echo $this->element('header'); ?>
		<div class="box-content">
			<div class="post-content">
                <?php echo $this->Session->flash(); ?>            
                <div class="form-login">
                    <form id="register_form" name="" method="post" action="">
                        <h4>Sửa thông tin tài khoản</h4>
                        <p>
                            <label>Họ tên:</label>
                            <input type="text" name="data[User][name]" value="<?php echo $user_info['name'] ?>" />
                        </p>
                        <p>
                            <label>Ngày sinh:</label>
                            <input type="text" id="date_birth" name="data[User][date_birth]" value="<?php echo substr($user_info['date_birth'],8,2).'/'.substr($user_info['date_birth'],5,2).'/'.substr($user_info['date_birth'],0,4) ?>" />
                        </p>
                        <p>
                            <label>Số điện thoại:</label>
                            <input type="text" name="data[User][phone]" value="<?php echo $user_info['phone'] ?>" />
                        </p>
                        <p style="display:inline-block; width:100%">
                            <label>Giới tính:</label>
                            <?php
                                $checked_men = '';
                                $checked_girl = '';
                                $checked = $user_info['gender'] == 1 ? $checked_men = "checked='checked'" : '';
                                $checked = $user_info['gender'] == 0 ? $checked_girl = "checked='checked'" : '';
                            ?>
                            <label class="gen"><input <?php echo $checked_men ?> type="radio" name="data[User][gender]" value="1" /> Nam </label>
                            <label class="gen"><input <?php echo $checked_girl ?> type="radio" name="data[User][gender]" value="0" /> Nữ </label>
                        </p>
                        <p>
                            <label>Địa chỉ:</label>
                            <textarea name="data[User][address]"><?php echo $user_info['address'] ?></textarea>
                        </p>
                        <p>
                            <input type="submit" name="" value="Cập nhật" />
                        </p>
                    </form>
                </div>
            </div>
		</div>
	</div>
	<?php echo $this->element('footer'); ?>
</div>

<script>
    $(document).ready(function(){
        var validator = $("#register_form").validate({ 
        rules: { 
            'data[User][name]': { 
                required: true,
            }, 
        }, 
        messages: { 
            'data[User][name]': { 
                required: "Điền họ tên.",
            },
        },
        
        submitHandler: function(form) {
            $('#register_form').submit();
		}

    });
        
        $('#date_birth').datetimepicker({
            timepicker:false,
        	format:'d/m/Y'
        });
        
    });
</script>
